package com.vaannila.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.source.utilidad.MenuItem;
import com.source.utilidad.ObjetoMenu;
import com.source.utilidad.UsuarioEntorno;

public class InicioAction extends ActionSupport implements SessionAware {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String scritpMenu;	
	private String name;

        List<MenuItem> verticalMenu = new ArrayList<MenuItem>();
	public List<MenuItem> getVerticalMenu() {
		return verticalMenu;
	}

	public void setVerticalMenu(List<MenuItem> verticalMenu) {
		this.verticalMenu = verticalMenu;
	}

	private Map session;
	private String id = "";

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}	

	public Map getSession() {
		return session;
	}

	public void setSession(Map session) {
		this.session = session;
	}
	
	public String getJSON() {
        return execute();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}	

	public String getScritpMenu() {
		return scritpMenu;
	}

	public void setScritpMenu(String scritpMenu) {
		this.scritpMenu = scritpMenu;
	}

	public String execute() {
		Map session = ActionContext.getContext().getSession();
		System.out.println(" INICIO 01 ");
		UsuarioEntorno uEntorno = new UsuarioEntorno();
		uEntorno.setNombre("Marco");
		uEntorno.setIdioma("ca");
		getSession().put("uEntorno", uEntorno);		
		getSession().put("name", "welcome1");
		setName("Marco Guado");
		System.out.println("carga pagina de inicio");
		ObjetoMenu om = new ObjetoMenu("ca");
		setScritpMenu(om.getMenu().get("stringMenu").toString());
		return "inicio";		
	}
        
}
